package org.xg.study.pd;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;

/**
 * @author CMG
 * @version 1.0
 * @description
 * @cLassName LotteryServiceImpl
 * @date 2021/9/17 10:04
 **/
public class LotteryServiceImpl implements LotteryService {
    private Logger logger = LoggerFactory.getLogger(LotteryServiceImpl.class);

    private MiniBusTargetService miniBusTargetService = new MiniBusTargetService();

    @Override
    public LotteryResult doDraw(String uId) {
        //摇号
        String lottery = miniBusTargetService.lottery(uId);
        //发信息
        logger.info("给用户：{} 发送短信通知（短信）：{}", uId, lottery);
        //给MQ发消息
        logger.info("记录用户：{} 摇号结果：{}", uId, lottery);
        //结果
        return new LotteryResult(uId, lottery, new Date());
    }
}
